<template>
    <div class="comment">
        <div v-for="item in content" :key="item.id" style="width:50%">
            <div class="comment-outBox" @click="goBlogDetail(item.blogID)">
                <span>{{ item.title }}</span>
                <div class="comment-innerBox">
                    <div class="comment-avatar">
                        <img :src="$store.getters.user.avatar" alt="" />
                    </div>
                    <div class="comment-info">
                        {{ $store.getters.user.realname }}
                        <span>
                            {{ (item.time * 1) | format }}
                        </span>
                        {{ item.goodNum }}
                        <p>
                            {{ item.content }}
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import {
        formatTime
    } from "../../../../formatTime";
    export default {
        props: {
            content: Array,
            default: () => [],
        },
        methods:{
            goBlogDetail(id){
                this.$router.push("/detail/"+id)
            }
        },
        filters: {
            format(val) {
                return formatTime(val);
            },
        },
    };
</script>

<style lang="less" scoped>
    .comment {
        box-sizing: border-box;
        padding: 2px 15px;
        display: flex;
        flex-wrap: wrap;
        .comment-outBox {
            background-color: rgba(0, 0, 0, 0.1);
            margin: 10px;
            padding: 10px;
            border-radius: 10px;
            transition: all 0.3s;

            &:hover {
                transform: scale(1.02);
                cursor: url("../../../../assets/img/cur/mais.png"), default;

                .comment-innerBox {
                    background-color: rgba(255, 255, 255, 0.8);
                }
            }
        }

        .comment-innerBox {
            display: flex;
            background-color: rgba(255, 255, 255, 0.6);
            border-radius: 10px;
            padding: 5px;

            &:hover {
                cursor: url("../../../../assets/img/cur/mais.png"), default;
            }

            .comment-avatar {
                img {
                    border-radius: 50%;
                    width: 50px;
                    height: 50px;
                }
            }

            .comment-info {
                color: #555;
                font-size: 12px;
                font-weight: 200;

                span {
                    margin: 0 5px;
                }

                p {
                    margin-top: 5px;
                    font-weight: 400;
                    font-size: 16px;
                }
            }
        }
    }
</style>